###############################################
# ORDER OF THE SACRED MAGDALENE
# MAGDALENE PRIMOGENITURE
#
# Special succession law for Catholic women of
# the Order using normal tribal or feudal government.
# The inheritance base is Primogeniture and the
# gender rule is Enatic.
#
# A permanent title flag records that the reform has
# previously been established so succession repair
# can survive a change of ruler.
###############################################

succession_laws = {

    succ_magdalene_primogeniture = {
        oldest_child_opinion = 10
        youngest_child_opinion = -15
        child_opinion = -10
        dynasty_opinion = -5

        potential = {
            # The law is valid on every county-or-higher title personally held
            # by an eligible Magdalene ruler. Do not exclude titular or unusual
            # kingdom titles merely because of title-type flags.
            OR = {
                tier = COUNT
                tier = DUKE
                tier = KING
                tier = EMPEROR
            }

            OR = {
                holder_scope = {
                    is_female = yes
                    religion = catholic
                    society_member_of = ggsm_order_sacred_magdalene

                    OR = {
                        government = feudal_government
                        government = tribal_government
                    }
                }

                # Once established, permit the law to survive a brief
                # government-validation transition during succession.
                AND = {
                    has_title_flag = ggsm_magdalene_succession_established

                    holder_scope = {
                        is_female = yes
                        religion = catholic
                        society_member_of = ggsm_order_sacred_magdalene
                    }
                }
            }

            holder_scope = {
                is_nomadic = no
                is_merchant_republic = no
                is_patrician = no
            }

            rebel = no
            NOT = { holder_scope = { government = confucian_bureaucracy } }
            NOT = { holder_scope = { government = chinese_imperial_government } }
        }

        allow = {
            holder_scope = {
                show_scope_change = no
                in_revolt = no
            }
        }

        effect = {
            succession = primogeniture
            gender_succ = enatic
            law_set_allow_matrilineal_marriage = yes

            # Durable marker used by succession repair.
            set_title_flag = ggsm_magdalene_succession_established
        }

        revoke_allowed = {
            always = no
        }
    }
}
